import { createWebHistory, createRouter } from "vue-router";
const routes = [
    { path: '/', redirect: '/home' },
    //主页路由
    { path: '/home', name: "home", meta: { title: "就业职通车" }, 
     component: () => import('@/pages/home.vue') },
    //招聘页路由
    { path: '/job', name: "job", meta: { title: "招聘岗位" }, 
     component: () => import('@/pages/jobs.vue') },
    //简历页路由
    { path: '/vitae', name: "vitae", meta: { title: "简历管理" }, 
     component: () => import('@/pages/vitae.vue') },
    //“我的”页路由
    { path: '/mine', name: "mine",  meta: { title: "我的" }, 
     component: () => import('@/pages/mine.vue') },
]
const router = createRouter({
    history: createWebHistory(),
    routes: routes,
    linkActiveClass: 'active',
});

router.beforeEach((to, from, next) => {
    if (to.meta.title) { 
        document.title = to.meta.title
    }
    return next()
})
export default router